package com.rd.student.jiaji.class3.caiyuxin.Java8_1;

import java.util.Arrays;

public class Choose {
    public static void main(String[] args) {
        int[] arr={1,12,45,78,23,67,26,59};
        choose(arr);
    }
    public static void choose(int[] arr){



        for (int i=1;i<arr.length;i++){

            int count=i-1;
            for (int j=i;j<arr.length;j++){

                if (arr[j]<arr[count]){
                    count=j;
                }
            }
            System.out.println("最小值为"+count);



                int a = arr[i-1 ];
                arr[i -1] = arr[count];
                arr[count] = a;
            






        }
        System.out.println(Arrays.toString(arr));
    }
}
